package operator;

import book.Book;
import book.BookList;

import java.util.Scanner;

/**
 * Version: 1.1
 * Author: TangJun
 * Date: 2024-07-18
 */
public class FindOperaion implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("开始查找图书");
        System.out.println("请输入你要查找的图书书名");
        Scanner scan = new Scanner(System.in);
        String name = scan.next();
        int index = this.findIndex(bookList, name);
        if (index >= 0) {
            System.out.println("找到了，《" + name + "》信息如下");
            System.out.println(bookList.getPos(index));
            return;
        }
        System.out.println("找不到这本书");
    }
}
